
export type Pesron = {
  name:string
  age:number
  text:string
}

const proxy = (object:any,key:any) => {
  return new Proxy(object, {
    get(target, prop, receiver){
      console.log(`get key ===>${key}`)
      return Reflect.get(target, prop, receiver)
    },

    set(target, prop, value, receiver){
       return Reflect.set(target, prop, value, receiver)    
    }
  })
}


const logAccess  = <T>(object:T ,key: keyof T): T =>{

  return proxy(object,key)

}

let man:Pesron = logAccess({
  name:'123',
  age:1,
  text:'123'
},'name')